/**
 * @输入一个数字计算所有位数的和
 *
 * @author	 wangshikun <wangshikun2010@gmail.com>
 * @copyright	(c) 2012 wangshikun <wangshikun2010@gmail.com>
 * @license	http://www.opensource.org/licenses/mit-license.php The MIT License
 * @package	default
 * @subpackage	default
 */

#include <stdio.h>
#include <cs50.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {
	int n, s = 0, i=0;

	printf("请输入一个数：");
	scanf("%d", &n);

	while (n != 0) {
		int num = n % 10;
		s += num;
		n = n / 10;
		i++;
	}

	printf("输入的数字是%d位数，所有的位数和是%d\n", i, s);
}
